﻿using System;

namespace Validate.Net
{
    /// <summary>
    /// 字母校验（只能包含字母）
    /// </summary>
    public class ValidateLetterAttribute : ValidateRegularAttribute
    {
        private static string regularStr = @"^[a-zA-Z]+$";

        public ValidateLetterAttribute() : base(regularStr)
        { }

        public override bool Validate(object value, out string msg)
        {
            if (base.Validate(value, out msg))
                return true;
            else
            {
                msg = "字母校验失败,只能包含字母";
                return false;
            }
        }
        
    }
}
